package book;

/**
 * Created with IntelliJ IDEA.
 * Description:此类来描绘书的内容
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2024-01-03  08:46
 */
public class Book {
    //每本书具有的属性，书名、作者、价格、种类、是否借阅。
    private String name;
    private String author;
    private int price;
    private String type;
    private boolean isBorrowed;

    public Book(String name, String author, int price, String type) {
        this.name = name;
        this.author = author;
        this.price = price;
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

     public boolean isBorrowed() {
        return isBorrowed;
    }

    public void setBorrowed(boolean borrowed) {
        isBorrowed = borrowed;
    }

    @Override
    public String  toString() {
        return "《" + name + '》' +
                "  作者:" + author +
                "  种类:" + type +
                "  ¥:" + price + "  状态:" +
                ((isBorrowed == false) ? " 未借阅" : " 已借阅");
    }
}
